﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication4
{
    public partial class Monitors : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {

            for (int i = 0; i < GridView4.Rows.Count; i++)
            {

                GridViewRow rows = GridView4.Rows[i];
                bool isChecked = ((CheckBox)rows.FindControl("select2")).Checked;
                TextBox text = (TextBox)rows.FindControl("txtQuantity2");
                if (isChecked)
                {
                    string id = GridView4.Rows[i].Cells[0].Text;
                    string name = GridView4.Rows[i].Cells[1].Text;
                    string brand = GridView4.Rows[i].Cells[2].Text;
                    string category = GridView4.Rows[i].Cells[3].Text;
                    string price = GridView4.Rows[i].Cells[4].Text;



                    Session["id" + Default.j] = id;
                    Session["name" + Default.j] = name;
                    Session["brand" + Default.j] = brand;
                    Session["category" + Default.j] = category;
                    Session["price" + Default.j] = price;
                    Session["quantity" + Default.j] = text.Text;



                    Default.j++;
                    Label4.Text = "Your item(s) has been added to the cart";

                }
            }
        }
    }
}